
interface ConfirmOptions {
    title?: string;
    message: string;
    confirmButtonText?: string;
    cancelButtonText?: string;
    type?: 'success' | 'warning' | 'info' | 'error';
}

export const showConfirm = async ({
    title = '提示',
    message,
    confirmButtonText = '确定',
    cancelButtonText = '取消',
    type = 'warning'
}: ConfirmOptions): Promise<boolean> => {
    try {
        await ElMessageBox.confirm(
            message,
            title,
            {
                confirmButtonText,
                cancelButtonText,
                type,
            }
        )
        return true
    } catch {
        ElMessage({
            type: 'info',
            message: '已取消操作',
        })
        return false
    }
} 